package com.ailk.emall.system.config;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.velocity.VelocityProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver;

/** 
 * 
 * @author zhaowg3
 * @Date 2016年12月25日
 */
@Configuration
public class VelocityConfig {
	private Log logger = LogFactory.getLog(VelocityConfig.class);
	@Value("${spring.velocity.layoutUrl}")
	private String layoutUrl;
	@SuppressWarnings("deprecation")
	@Bean(name = "velocityViewResolver")
	public VelocityLayoutViewResolver velocityViewResolver(VelocityProperties properties) {
	    VelocityLayoutViewResolver resolver = new VelocityLayoutViewResolver();
	    properties.applyToViewResolver(resolver);
	    resolver.setLayoutUrl(layoutUrl);
	    return resolver;
	}
}
